//package com.pug.security.config;
//
//import org.springframework.boot.autoconfigure.security.servlet.PathRequest;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.builders.WebSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//
///**
// * @program: xq_pug_alibabacloud_parent
// * @description: from表单认证配置
// * @author: Mr.Ren
// * @create: 2023-07-16 16:25
// **/
//@Configuration
//@EnableWebSecurity
//public class SecurityConfig02 extends WebSecurityConfigurerAdapter {
//
//
//    //认证
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        http
//                //所有请求都需要认证才能访问
//                .authorizeRequests().anyRequest().authenticated()
//                .and()
//                //开启表单认证方式
//                .formLogin().loginPage("/login1.html").permitAll()
//                .and()
//                //关闭古老的basic认证方式
//                .httpBasic().disable();
//    }
//
//
//    //授权
//    @Override
//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//        //此处配置是基于内存还是基于数据库
//
//        //基于内存 roles里面的东西自定义，写什么都可以
//        auth.inMemoryAuthentication()
//                .withUser("zhangsan").password("{noop}zhangsan").roles("admin")
//                .and()
//                .withUser("lisi").password("{noop}lisi").roles("admin")
//                .and()
//                .withUser("wangwu").password("{noop}wangwu").roles("aaa");
//
//
//        //基于数据库
//        //自己写个业务类了
//    }
//
//
//    //web资源配置
//    @Override
//    public void configure(WebSecurity web) throws Exception {
//        //对assets目录下的在静态资源不拦截
//       web.ignoring().mvcMatchers("/assets/**","/error")
//               .requestMatchers(PathRequest.toStaticResources().atCommonLocations());
//    }
//}
